//////////////////////////////////////////////////////
//													//
//       Interface for the CXmlParser class.        // 
//													//
//////////////////////////////////////////////////////

#ifndef _XMLDOCUMENT_H_
#define _XMLDOCUMENT_H_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "XmlElement.h"


class CXmlDocument
{
public:
	CXmlDocument();
	virtual ~CXmlDocument();
	
	// get root element of the link list
	CXmlElement *GetRootElement() { return &m_RootElement; }
	//Initialize variables to their initial values.
    void DeleteContents();
	//Parse XML data.
	BOOL Parse(LPCTSTR lpszString);
	//Get first child of element.
	CXmlElement *GetFirstChild(CXmlElement *pElement);
	//Get next child of specified element.	
	CXmlElement *GetNextSibling(CXmlElement *pElement);
	//Find first occurence of specified tag.	
	CXmlElement *FindElement(CXmlElement *pElement, LPCTSTR lpszName);
	//Find next occurence of specified tag
	CXmlElement *FindNextElement(CXmlElement *pElement);
	//Set document from XML file
	BOOL SetXmlFile(LPCTSTR lpszFileName);
	
protected:
	//Determine type and name of the tag.
	int ValidateTag(CString &strTag, CString &strResult);

	CString m_strXml;

	//variable for root element
	CXmlElement m_RootElement;
	//pointer to current element
	CXmlElement *m_pCurElement;
};

#endif // _XMLDOCUMENT_H_)
